package com.alo.alowebproject.action;

import java.util.List;

import com.opensymphony.xwork2.ActionContext;
import com.opensymphony.xwork2.ActionSupport;
import com.alo.alowebproject.business.AccountBusiness;
//import com.alo.alowebproject.model.Account;

public class LoginAction extends ActionSupport{
	private String username;
	private String pwd1;
	private String pwd2;
	private List info;
	
	public String getUsername(){
		return username;	
	}
	public void setUsername(String username){
		this.username = username;
	}
	public String getPwd1(){
		return pwd1;	
	}
	public void setPwd1(String pwd1){
		this.pwd1 = pwd1;
	}
	public String getPwd2(){
		return pwd2;	
	}
	public void setPwd2(String pwd2){
		this.pwd2 = pwd2;
	}
	public List getInfo(){
		return info;	
	}
	public void setInfo(List info){
		this.info = info;
	}
	
	public String execute() throws Exception {
		boolean loginDone;
		AccountBusiness login = new AccountBusiness();
		loginDone = login.isAccount(getUsername(), getPwd1(), getPwd2());
		if(loginDone){
			info = login.Info(getUsername(), getPwd1());
			ActionContext ac = ActionContext.getContext();
			ac.put("getInfo", info);
			//HttpServletRequest request = null;
			//request.setAttribute("getInfo", info);
			return SUCCESS;
		}
		else
			return INPUT;
	}
}
